function str2config(str)
  use global_param, only:n_point_type
  implicit none

  interface
     subroutine str2id(str,pid)
       character :: str*(*)
       integer,intent(out) :: pid
     end subroutine str2id
  end interface

  integer,pointer,dimension(:) :: str2config
  character :: str*(*)

  integer :: i,j
  integer :: asci_code,len_str,ierr
  integer :: count,icount,lcount,pid,psize

  allocate(str2config(n_point_type),stat=ierr)
  if (ierr.ne.0) call abnormal_stop("str2config",&
       "Memory allocation caused an error.")

  do i=1,n_point_type
     str2config(i)=0
  end do

  len_str=len_trim(str)
  str=trim(adjustl(str))
  if (len_str.eq.0) return

  icount=1
  do i=1,n_point_type
     ! String
     do j=icount,len_str
        asci_code=ichar(str(j:j))
        if (asci_code.ge.65.and.asci_code.le.90) cycle
        if (asci_code.ge.97.and.asci_code.le.122) cycle
        if (asci_code.ge.48.and.asci_code.le.57) then
           lcount=j-1
           exit
        end if
     end do

     ! Conversion from string to id number of elementary point type
     call str2id(str(icount:lcount),pid)
     if (pid.eq.0) then
        call terminal_msg1(trim(adjustl(str)))
        call abnormal_stop("str2config",&
             "Unrecongnized type of point defect is found.")
     end if

     ! Read its size
     icount=lcount+1
     do j=icount,len_str
        asci_code=ichar(str(j:j))
        if (asci_code.ge.48.and.asci_code.le.57) lcount=j
        if (asci_code.ge.65.and.asci_code.le.90) exit
        if (asci_code.ge.97.and.asci_code.le.122) exit
     end do

     read(str(icount:lcount),*) psize

     str2config(pid)=psize

     if (lcount.eq.len_str) exit

     icount=lcount+1

  end do

  return

end function str2config
